<%--
  @author Tharanga Punchihewa
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<div id="land-registration-module-home-title" class="module-home-title">
    <s:a href="landAlienationModuleHome.do"><img src="${pageContext.request.contextPath}/images/interest-party.png"
                                                 alt="Land Alienation"><span><s:label
            value="%{getText('land_alienation_module.label')}"/></span></s:a>
    <span class="module-title-breaker"> > </span>
    <s:if test="#session.userGroup=='ords'">
        <s:a href="initApplicationApprove.do"><img src="${pageContext.request.contextPath}/images/accept.png"
                                                   alt="Land Alienation"><span><s:label
                value="%{getText('initial_alienation_applications_approval.label')}"/></span></s:a>
        <div id="back-button" align="right">
                       <s:form><s:submit value="%{getText('back_btn.label')}" action="landAlienationModuleHome"/></s:form>
                </div>
    </s:if>
    <s:if test="#session.userGroup=='lo'">
        <s:a href="initApplicationToBeEdit.do"><img src="${pageContext.request.contextPath}/images/modify-form.png"
                                                    alt="Land Alienation"><span><s:label
                value="%{getText('modify_initial_alienation_applications.label')}"/></span></s:a>
        <div id="back-button" align="right">
               <s:form><s:submit value="%{getText('back_btn.label')}" action="landAlienationModuleHome"/></s:form>
        </div>
    </s:if>




</div>

<s:if test="#session.userGroup=='ords'">
    <%--<s:include value="../notifications.jsp"/>--%>
    <h2><s:label value="%{getText('initial_alienation_applications_approval.label')}"/></h2>
</s:if>
<s:if test="#session.userGroup=='lo' || #session.userGroup=='orlm'">
    <h2><s:label value="%{getText('modify_initial_alienation_applications.label')}"/></h2>
</s:if>

<script type="text/javascript">
    $('.inputDates').DatePicker({
        format:'m/d/Y',
        date: $('#inputDate').val(),
        current: $('#inputDate').val(),
        starts: 1,
        position: 'right',
        onBeforeShow: function() {
            $('#inputDate').DatePickerSetDate($('#inputDate').val(), true);
        },
        onChange: function(formated, dates) {
            $('#inputDate').val(formated);
            if ($('#closeOnSelect input').attr('checked')) {
                $('#inputDate').DatePickerHide();
            }
        }
    });
    $(document).ready(function() {
        $('.land-table').dataTable({
            aaSorting: [],
            "sPaginationType": "full_numbers",
            "bDestroy": true,
            "oLanguage": {
                "sZeroRecords": $('#no-record').val(),
                "sLengthMenu": $('#display').val() + " _MENU_ " + $('#records').val(),
                "sSearch": $('#search').val(),
                "sInfo": $('#showing').val() + " _START_ " + $('#to').val() + " _END_ " + $('#of').val() + " _TOTAL_ " + $('#entries').val(),
                "sInfoEmpty": $('#no-record').val(),
                "oPaginate": {
                    "sFirst": $('#first').val(),
                    "sLast": $('#last').val(),
                    "sNext": $('#next').val(),
                    "sPrevious": $('#previous').val()
                }
            }
        });
    });
</script>

<s:if test="hasActionErrors() || hasActionMessages()">
    <div id="message-box" class="message-box">
        <div class="action-msg"><s:actionmessage/></div>
        <div class="action-err"><s:actionerror/></div>
    </div>
</s:if>
<table class="width-100 margin-10-auto table land-table">
    <thead>
    <tr class="center-align table-header">
        <th><s:label value="%{getText('applied_date.label')}"/></th>
        <th><s:label value="%{getText('applicant_name.label')}"/></th>
        <th><s:label value="%{getText('status.label')}"/></th>
        <s:if test="#session.userGroup=='ords' || #session.userGroup=='orip'">
            <th><s:label value="%{getText('edit.label')}"/></th>
        </s:if>
        <s:if test="#session.userGroup=='lo' || #session.userGroup=='orlm' || #session.userGroup=='orip'">

            <th><s:label value="%{getText('approve.label')}"/></th>

        </s:if>
    </tr>
    </thead>
    <tbody>
    <s:iterator status="status1" value="landApplicationList">
        <tr>
            <td class="center-align"><s:property value="submitDate"/></td>
            <td><s:property value="holder.name"/></td>
            <td><s:property value="initialStatus"/></td>

            <s:if test="#session.userGroup=='lo' || #session.userGroup=='orlm' || #session.userGroup=='orip'">
              <%--  <td class="center-align">
                       <s:label value="%{status}"/>--%>

                  <%--  <s:if test="status.ordinal()== 0">
                        <s:label value="%{getText('data_entry.label')}"/>
                    </s:if>
                    <s:elseif test="status.ordinal()== 3">
                        <s:label value="%{getText('rejected.label')}"/>
                    </s:elseif>--%>
                <%--</td>--%>

                <td class="center-align">
                    <s:url id="editInitApplication" action="editInitApplication">
                        <s:param name="applicationId" value="id"/>
                    </s:url>
                    <s:a href="%{editInitApplication}" title="%{getText('edit_tooltip')}">
                        <img src="<s:url value='/images/modify-form.png'/>" border="none" width="25"
                             height="25"/>
                    </s:a>
                </td>
            </s:if>
            <s:if test="#session.userGroup=='ords' || #session.userGroup=='orip'">
                <%-- <td class="center-align">
                    <s:url id="editInitApplication" action="editInitApplication">
                        <s:param name="applicationId" value="id"/>
                    </s:url>
                    <s:a href="%{editInitApplication}">
                        <img src="<s:url value='/images/modify-form.png'/>" border="none" width="25"
                             height="25"/>
                    </s:a>
                </td>--%>
                <td class="center-align">
                    <s:url id="initApproveApplication" action="initApproveApplication">
                        <s:param name="applicationId" value="id"/>
                    </s:url>
                    <s:a href="%{initApproveApplication}" title="%{getText('approve_tooltip')}">
                        <img src="<s:url value='/images/approve.png'/>" border="none" width="25"
                             height="25"/>
                    </s:a>
                </td>

            </s:if>
        </tr>
    </s:iterator>
    </tbody>
</table>

<s:include value="../dataTableLocalizationLabels.jsp"/>